import 'package:flutter/widgets.dart';

class PaymentMethodFragmentTranslation {
  static final delegate = _PaymentMethodFragmentTranslationDelegate();

  static PaymentMethodFragmentTranslation of(BuildContext context) {
    return Localizations.of(context, PaymentMethodFragmentTranslation);
  }

  late String _languageCode;

  Future<void> load(Locale locale) async {
    _languageCode = locale.languageCode;
  }

  String _resolve(Map<String, String> translations) {
    return translations[_languageCode]!;
  }

  String get titleMarkdown {
    return _resolve(const {
      'ru': 'Способы #оплаты#',
    });
  }

  String get visaBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Visa',
    });
  }

  String get mastercardBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Mastercard',
    });
  }

  String get mirBankCardTypeLabel {
    return _resolve(const {
      'ru': 'МИР',
    });
  }

  String get unionPayBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Union Pay',
    });
  }

  String get jcbBankCardTypeLabel {
    return _resolve(const {
      'ru': 'JCB',
    });
  }

  String get americanExpressBankCardTypeLabel {
    return _resolve(const {
      'ru': 'American Express',
    });
  }

  String get dinersClubBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Diners Club',
    });
  }

  String get discoverCardBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Discover Card',
    });
  }

  String get instaPaymentBankCardTypeLabel {
    return _resolve(const {
      'ru': 'InstaPayment',
    });
  }

  String get instaPaymentTMBankCardTypeLabel {
    return _resolve(const {
      'ru': 'InstaPaymentTM',
    });
  }

  String get laserBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Laser',
    });
  }

  String get dankortBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Dankort',
    });
  }

  String get soloBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Solo',
    });
  }

  String get switchBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Switch',
    });
  }

  String get unknownBankCardTypeLabel {
    return _resolve(const {
      'ru': 'Карта',
    });
  }

  String buildBankCardExpirationTimeLabel({required String expirationMonth, required String expirationYear,}) {
    return _resolve( {
      'ru': 'Действительна до $expirationMonth/$expirationYear',
    });
  }

  String get expiredBankCardFailureMessage {
    return _resolve(const {
      'ru': 'Срок действия карты истёк',
    });
  }

  String get unavailableBankCardFailureMessage {
    return _resolve(const {
      'ru': 'Карта недоступна',
    });
  }
}

class _PaymentMethodFragmentTranslationDelegate
    extends LocalizationsDelegate<PaymentMethodFragmentTranslation> {
  @override
  bool isSupported(Locale locale) => const ['ru'].contains(locale.languageCode);

  @override
  bool shouldReload(LocalizationsDelegate<PaymentMethodFragmentTranslation> old) => false;

  @override
  Future<PaymentMethodFragmentTranslation> load(Locale locale) async {
    final translation = PaymentMethodFragmentTranslation();
    await translation.load(locale);
    return translation;
  }
}
